package com.zt.common.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * description:
 * author:张腾
 * date:2021-05-21
 */


@Data
@AllArgsConstructor
public class ApiException extends RuntimeException{

    private static final long serialVersionUID = 1L;

    /**
     * 存放错误状态码以及错误消息
     */
    private CodeMsg codeMsg;

    private String message;

    public ApiException(CodeMsg codeMsg) {
        this.codeMsg = codeMsg;
    }
    public ApiException(String message) {
        this.message = message;
    }

    public String getMessage() {
        return codeMsg.getResultMsg();
    }

    public String getMes(){
        return this.message;
    }

    @Override
    public Throwable fillInStackTrace() {
        return this;
    }

}
